
/*******************************************************
*  Team name: FTPMP 
*  Class involve: SACardController, BoardEngine
*  Version, Author, History of modification: 
*  Ver 1.0, Fred,
*  -add SACardWindow constructor, answeredEvent, checkMT, 
*******************************************************/


package control;

import entity.Card;
import entity.SA;
import entity.Player;
import boundary.SACardWindow;
import boundary.RoundWindow;

public class SACardController extends CardController
{
	int pid;
	int said;
	String name;
	SACardWindow SACardWindow;
	BoardEngine be;
	public SACardController(BoardEngine BE,RoundWindow RW)
	{
		super.boardEngine=BE;
		be = super.boardEngine;
		super.roundWindow=RW;
		super.board=super.boardEngine.getBoard();
	}
	
	@Override
	protected void drawCard(Card card, int theplayer) {
		SA sa =(SA)card;
		this.SACardWindow.setLabel(sa.getSAname(), sa.getSAinfo(), sa.getSAID(), theplayer);
	}

	public void answeredEvent(int PID, int SAID, int ans) 
	{
		super.board.giveReward(PID,SAID,ans,this.getClass().getName());
		super.roundWindow.checkEndBtnState();
	}
	
	public boolean checkMT(int pid, String MTType) 
	{
		return be.validUserMtType(pid, MTType);
	}

	public void initSACardWindow(SACardWindow SW) {
		this.SACardWindow=SW;
	}

	public SACardWindow getSACardWindow() 
	{
		return this.SACardWindow;
	}

}
